/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.proyectoGonseca.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

@Entity
@Table(name = "usuarios", catalog = "gonseca", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Usuarios.findAll", query = "SELECT c FROM Usuarios c"),
    @NamedQuery(name = "Usuarios.findByid_usuarios", query = "SELECT c FROM Usuarios c WHERE c.id_usuarios = :id_usuarios"),
    @NamedQuery(name = "Usuarios.findBynombre", query = "SELECT c FROM Usuarios c WHERE c.nombre = :nombre"),
    @NamedQuery(name = "Usuarios.findBycorreo", query = "SELECT c FROM Usuarios c WHERE c.correo = :correo"),
    @NamedQuery(name = "Usuarios.findBypassword", query = "SELECT c FROM Usuarios c WHERE c.password = :password"),
    @NamedQuery(name = "Usuarios.findByusername", query = "SELECT c FROM Usuarios c WHERE c.username = :username"),
    @NamedQuery(name = "Usuarios.findBycreditos", query = "SELECT c FROM Usuarios c WHERE c.creditos = :creditos")})

public class Usuarios implements Serializable {
    private static final long serialVersionUID = 1L;

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "id_usuarios")
    private Integer id_usuarios;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "nombre")
    private String nombre;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 150)
    @Column(name = "correo")
    private String correo;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 55)
    @Column(name = "password")
    private String password;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 55)
    @Column(name = "username")
    private String username;
    @Basic(optional = false)
    @NotNull
    @Column(name = "creditos")
    private int creditos;
   
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "usuarios")
    private List<Parciales> parcialesList;
    
    public Usuarios() {
    }
    
  

    public Usuarios(Integer id, String nombre, String correo, String password, String username, int creditos) {
        this.id_usuarios = id_usuarios;
        this.nombre = nombre;
        this.correo = correo;
        this.password = password;
        this.username = username;
        this.creditos = creditos;
    }

   

    @Override
     
    public int hashCode() {
        int hash = 0;
        hash += (id_usuarios != null ? id_usuarios.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Usuarios)) {
            return false;
        }
        Usuarios other = (Usuarios) object;
        if ((this.id_usuarios == null && other.id_usuarios != null) || (this.id_usuarios != null && !this.id_usuarios.equals(other.id_usuarios))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.proyectoGonseca.entities.Usuarios[ id_usuario?=" + id_usuarios + " ]";
    }

    public int getId_usuarios() {
        return id_usuarios;
    }

    public String getNombre() {
        return nombre;
    }

    public String getCorreo() {
        return correo;
    }

    public String getPassword() {
        return password;
    }

    public String getUsername() {
        return username;
    }

    public int getCreditos() {
        return creditos;
    }

    public void setId_usuarios(int id_usuarios) {
        this.id_usuarios = id_usuarios;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public void setCorreo(String correo) {
        this.correo = correo;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public void setCreditos(int creditos) {
        this.creditos = creditos;
    }

    }